package com.zbf.order.mapper;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/12  14:35
 * 描述:
 */
@Mapper
@Repository
//@CacheNamespace(blocking = false)
public interface TestOrderMapper {

    @Insert("insert into base_order(id,goods_id,quantity,createTime,version)values(#{id},#{goodsId},#{quantity},NOW(),#{version})")
    public int insertOrder(Map<String,Object> order);

    @Insert("insert into base_message_recod(id,orderId,state,createTime,orderMs)values(#{id},#{orderId},#{state},NOW(),#{orderMs})")
    public int insertOrderMesg(Map<String,Object> orderMsg);

    @Update("update base_message_recod set state=#{state} where id=#{id}")
    public int updateOrder(Map<String,Object> orderMsg);

    @Select("select * from base_message_recod where id=#{id}")
    public Map<String,Object> getOrderInfo(String id);

    @Update("update base_stock set stock=stock-#{quantity} where id=#{id}")
    public int updateStock(Map<String,Object> map);


}
